| Total Complexity | 1 |
| Total Lines | 16 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | import { Controller, Get, Inject, UseGuards } from '@nestjs/common'; |
||
| 12 | |||
| 13 | @Controller('users') |
||
| 14 | @ApiTags('User') |
||
| 15 | @ApiBearerAuth() |
||
| 16 | @UseGuards(AuthGuard('bearer'), RolesGuard) |
||
| 17 | export class GetMeAction { |
||
| 18 | constructor( |
||
| 19 | @Inject('IQueryBus') |
||
| 20 | private readonly queryBus: IQueryBus |
||
| 21 | ) {} |
||
| 22 | |||
| 23 | @Get('me') |
||
| 24 | @Roles(UserRole.PHOTOGRAPHER, UserRole.DIRECTOR) |
||
| 25 | @ApiOperation({ summary: 'Get current user' }) |
||
| 26 | public async index(@LoggedUser() { id }: UserAuthView): Promise<UserView> { |
||
| 27 | return await this.queryBus.execute(new GetUserByIdQuery(id)); |
||
| 28 | } |
||
| 30 |